package com.baowenli.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import com.baowenli.pojo.Order;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OrderInfoMapper {

    /**
     * 添加人员住房登记信息
     */
    @ResultMap("brandResultMap")
    @Insert("INSERT INTO order_info VALUES(#{orderid},#{orderTypeId},#{orderType},#{userId},#{name},#{phone}," +
            "#{roomId},#{orderCost},now(),#{workId},#{roomInfoId},'1') ;")
    int insertOrderInfo(@Param("orderid") int orderId,@Param("orderTypeId") int orderTypeId,
         @Param("orderType") String orderType,@Param("userId") int userId,@Param("name") String name,
            @Param("phone") String phone,@Param("roomId") int room_id,@Param("orderCost") double orderCost,
                        @Param("workId") int workId
            ,@Param("roomInfoId") int roomInfoId);

    /**
     *  查看订单应支付支付钱
     *
    **/

    @ResultMap("brandResultMap")
    @Select("select * from order_info where room_id = #{roomId} and order_id = #{orderId}")
    Order findCountDayPrice(@Param("roomId") int roomId,@Param("orderId") int orderID);

    /**
     *  查看所有订单
     *
     * */
    @ResultMap("brandResultMap")
    @Select("select * from order_info where status = '1' and create_time >= #{datetime};")
    List<Order> selectAllOrderInfoAfter(String datetime);

    /**
     *  查看所有订单
     *
     * */
    @ResultMap("brandResultMap")
    @Select("select * from order_info where status = '1' and create_time <= #{datetime};")
    List<Order> selectAllOrderInfoBefore(String datetime);

    /**
     *  查看所有订单
     *
     * */
    @ResultMap("brandResultMap")
    @Select("select * from order_info where status = '1' and create_time = #{datetime};")
    List<Order> selectAllOrderInfoNow(String datetime);
}
